/**
 登陆
 */
$(document).ready(function() {
    $('input').iCheck({
        checkboxClass: 'iradio_square-red',
        increaseArea: '30%'
    });
});

var loadi;
function login () {
    var account =  $("#account").val().trim();
    var pwd = $("#pwd").val().trim();
    if(account==""){
        swal("系统提示", "账号不能为空", "error");
    }else if(pwd==""){
        swal("系统提示", "密码不能为空", "error");
    }else{
        loadi = layer.load("正在登陆平台,请稍后...");
        $.ajax({
            type:"get",
            url:"loginCheck?account="+account+"&pwd="+pwd+"&random="+Math.random(),
            timeout:6000,
            success:function (data) {
                layer.close(loadi);
                if (data=="success"){
                     location.href="main"
                }else{
                    swal("系统提示", "账号或者密码错误", "error");
                }
            },
            error:function () {
                layer.close(loadi);
                swal("系统提示", "登录超时，请稍后在访问", "error");
            }
        })
    }
}
//回车键登录
document.onkeydown=function(event){
    e = event ? event :(window.event ? window.event : null);
    if(e.keyCode==13){
        //执行的方法
        login();
    }
}